package com.hzcx.app.simplechat.ui.setting.presenter;

import android.content.Context;

import com.hzcx.app.simplechat.api.BaseDialogObserver;
import com.hzcx.app.simplechat.base.BaseEmptyBean;
import com.hzcx.app.simplechat.base.BasePresenter;
import com.hzcx.app.simplechat.model.PublicModel;
import com.hzcx.app.simplechat.model.SettingModel;
import com.hzcx.app.simplechat.ui.publicui.bean.ProtocolBean;
import com.hzcx.app.simplechat.ui.setting.bean.SettingFindMyWayBean;
import com.hzcx.app.simplechat.ui.setting.contract.AboutContract;
import com.hzcx.app.simplechat.ui.setting.contract.SettingFindMyWayContract;

import java.util.List;

public class SettingFindMyWayPresenter extends BasePresenter<SettingFindMyWayContract.View> implements SettingFindMyWayContract.Presenter {

    /**
     *  获取查找我的方式列表
     * @param context
     */
    @Override
    public void getSettingFindMyWayList(Context context) {
        SettingModel.getSettingFindMyWayList(context, new BaseDialogObserver<List<SettingFindMyWayBean>>(context) {
            @Override
            protected void onSuccess(List<SettingFindMyWayBean> data) {
                mView.myWayResult(data);
            }
        });
    }

    /**
     *  修改添加我的方式
     * @param context
     * @param tag
     * @param pos
     */
    @Override
    public void updateMyWay(Context context, String tag, int pos) {
        SettingModel.setPrivateConfig(context, null, null, null, null, tag, new BaseDialogObserver<BaseEmptyBean>(context) {
            @Override
            protected void onSuccess(BaseEmptyBean data) {
                mView.updateSuccess(pos);
            }

            @Override
            public void onFailure(Throwable e, String errorMsg) {
                super.onFailure(e, errorMsg);
                mView.updateFail(pos);
            }
        });
    }
}
